package config

import (
	"io/ioutil"
	"log"
	"gopkg.in/yaml.v2"
)

type Conf struct {
	Mysql struct {
		Host string
	}
	Base interface{}
}
type One struct {
	Abc string
}

var appConf *Conf

func init() {
	data, err := ioutil.ReadFile("app.yaml")
	if err != nil {
		log.Fatal(err)
	}
	err = yaml.Unmarshal([]byte(data), &appConf)
	if err != nil {
		log.Fatalf("error: %v", err)
	}
	var one One
	one.Abc = "abc"
	appConf.Base = "string"
	appConf.Base = one
}

func GetConf() *Conf {
	return appConf
}
